//
//  JYJAnchorColumnCollectionViewCellTwo.m
//  HappyListen
//
//  Created by 冀永金 on 16/9/2.
//  Copyright © 2016年 冀永金. All rights reserved.
//

#import "JYJAnchorColumnCollectionViewCellTwo.h"
#import "BaseLabel.h"
#import "Masonry.h"
#import "JYJTAMacro.h"
#import "JYJAnchorColumnModel.h"
#import "UIImageView+WebCache.h"
@interface JYJAnchorColumnCollectionViewCellTwo ()
@property (nonatomic, strong) UIImageView *backImage;
@property (nonatomic, strong) UIImageView *musicImage;
@property (nonatomic, strong) BaseLabel *nameLalel;
@end
@implementation JYJAnchorColumnCollectionViewCellTwo
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createViews];
    }
    return self;
}
- (void)createViews {
    self.musicImage = [[UIImageView alloc]init];
    [self.contentView addSubview:_musicImage];
    self.backImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"friend_item_head"]];
    [self.contentView addSubview:_backImage];
    self.nameLalel = [[BaseLabel alloc]init];
    [self.contentView addSubview:_nameLalel];
    
}
- (void)layoutSubviews {
    [super layoutSubviews];
    [self.backImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_top).with.offset(0);
        make.left.equalTo(self.contentView.mas_left).with.offset(0);
        make.width.mas_equalTo(self.contentView.bounds.size.width);
        make.height.mas_equalTo(self.contentView.bounds.size.width);
    }];
    [self.musicImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_top).with.offset(2);
        make.left.equalTo(self.contentView.mas_left).with.offset(2);
        make.width.mas_equalTo(self.contentView.bounds.size.width - 24);
        make.height.mas_equalTo(self.contentView.bounds.size.width - 4);
    }];
    [self.nameLalel mas_makeConstraints:^(MASConstraintMaker *make) {
       make.top.equalTo(self.backImage.mas_bottom).with.offset(5);
        make.left.equalTo(self.contentView.mas_left).with.offset(0);
        make.width.mas_equalTo(self.contentView.bounds.size.width);
        make.height.mas_equalTo(35);
    }];
}
- (void)setColumnModel:(JYJAnchorColumnModel *)columnModel {
    _columnModel = columnModel;
    [self.musicImage sd_setImageWithURL:[NSURL URLWithString:columnModel.item_thumbimg] placeholderImage:PLACEHOLDERIMAGE];
    self.nameLalel.text = columnModel.item_name;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
